<?
//user= snnnbrg2_a pass = dU=rbgA(SO71
  $url = urldecode(http_build_query($_GET));
  $url = explode('?', $url)[0];
  $url = explode('&', $url);
  $pass = explode('=',$url[0])[1];
  $user = explode('=',$url[3])[1];
  $Fname = explode('=',$url[1])[1];
  $Lname =  explode('=',$url[2])[1];
  $link = mysql_connect('localhost', 'root', '');
  if (!$link) {
    die('Not connected : ' . mysql_error());
  }

  // make foo the current FinalProject
  $db_selected = mysql_select_db('FinalProject', $link);
  if (!$db_selected) {
    die ('Can\'t use Final Project: ' . mysql_error());
  }

  // Formulate Query
          // This is the best way to perform an SQL query
          // For more examples, see mysql_real_escape_string()
          $query = sprintf("INSERT INTO `Users`(`Username`, `Password`, `Fname`, `Lname`) VALUES ('%s','%s','%s','%s')",
              mysql_real_escape_string($user),
              mysql_real_escape_string($pass),
              mysql_real_escape_string($Fname),
              mysql_real_escape_string($Lname));

          // Perform Query
          $result = mysql_query($query);

          // Check result
          // This shows the actual query sent to MySQL, and the error. Useful for debugging.
          if (!$result) {
                 $message  = 'Invalid query: '.mysql_error().' ';
                 $message .= 'Whole query: '.$query;
                 die($message);
          }
          header("Location: ../index.php");

?>